home *** CD-ROM | disk | FTP | other *** search
/ The X-Philes (2nd Revision) / The X-Philes Number 1 (1995).iso / xphiles / hp95 / gnuchess.arc / hp95.c < prev    next >
C/C++ Source or Header  |  1992-01-16  |  1KB  |  77 lines

  1. # if defined(MSDOS)
  2. #    include    <dos.h>
  3. # else
  4. #    define    cdecl
  5. #    define    far
  6. # endif
  7. # include    "hp95.h"
  8.  
  9. struct font_map {
  10.     G_AREA    g_area;
  11.     char    g_bits[5];
  12.     };
  13.  
  14. struct font_map ascii_bitmaps[] = {
  15. # include    "ascii3x5.bm"
  16.     };
  17.  
  18. void
  19. G_Mode(mode)
  20. int    mode;
  21. {
  22. # if defined(MSDOS)
  23.     union REGS    regs;
  24.     union REGS    oregs;
  25.  
  26.     regs.h.ah = 0;
  27.     regs.h.al = mode;
  28.     int86(0x5f, ®s, &oregs);
  29. # endif
  30. }
  31. void
  32. G_ImagePut(x, y, ptr, mode)
  33. int    x;
  34. int    y;
  35. char    *ptr;
  36. int    mode;
  37. {
  38. # if defined(MSDOS)
  39.     union REGS    regs;
  40.     union REGS    oregs;
  41.     struct SREGS    sregs;
  42.  
  43.     regs.h.ah = 0x0e;
  44.     regs.h.al = mode;
  45.     regs.x.cx = x;
  46.     regs.x.dx = y;
  47.     regs.x.di = FP_OFF(ptr);
  48.     sregs.es = FP_SEG(ptr);
  49.     int86x(0x5f, ®s, &oregs, &sregs);
  50. # endif
  51. }
  52. /**********************************************************************/
  53. /*   Function to draw a string in the 3x5 ASCII font.              */
  54. /**********************************************************************/
  55. void
  56. draw_small_string(x, y, str)
  57. int    x, y;
  58. char    *str;
  59. {    int    ch;
  60.  
  61.     while (*str) {
  62.         ch = *str & 0xff;
  63.         if (ch == ' ')
  64.             x++;
  65.         else if (ch > ' ') {
  66.             if (ch >= 0x60)
  67.                 ch -= 0x20;
  68.             ch -= ' ' + 1;
  69.             draw_bitmap(x, y, &ascii_bitmaps[ch]);
  70.             x += ascii_bitmaps[ch].g_area.width + 1;
  71.             }
  72.         str++;
  73.         }
  74. }
  75.  
  76.  
  77.